package com.lagou.mr.sort;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;
import java.util.Arrays;

public class SortMapper extends Mapper<LongWritable, Text,SpeakBeanSort, NullWritable> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, SpeakBeanSort, NullWritable>.Context context) throws IOException, InterruptedException {
        String[] arr = value.toString().split("\t");
        //System.out.println(Arrays.toString(arr));
        //System.exit(1);
        SpeakBeanSort k = new SpeakBeanSort(Long.parseLong(arr[4]), Long.parseLong(arr[5]), arr[1]);
        context.write(k,NullWritable.get());
    }
}
